//
//  MyComentWithImageViewCell.m
//  shopping
//
//  Created by 徐双 on 2017/9/15.
//  Copyright © 2017年 qianyi. All rights reserved.
//

#import "MyComentWithImageViewCell.h"
#import "MyCommentCollectionViewCell.h"
@interface MyComentWithImageViewCell ()<UICollectionViewDelegate, UICollectionViewDataSource, UICollectionViewDelegateFlowLayout>


@end
@implementation MyComentWithImageViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    self.goodsImg.layer.cornerRadius = 22.0f;
    self.goodsImg.layer.masksToBounds = YES;
    
    
   // UICollectionViewFlowLayout *layout = [[UICollectionViewFlowLayout alloc] init];
    
    //layout.itemSize = CGSizeMake((DEF_SCREEN_WIDTH - 40)  / 3, 105);
    
    //self.myCollectionview.frame = [
    
    [self.myCollectionview layoutIfNeeded];
    //    self.automaticallyAdjustsScrollViewInsets = NO;
    self.myCollectionview.pagingEnabled = NO;
    self.myCollectionview.delegate = self;
    self.myCollectionview.dataSource = self;
    
    
    [self.myCollectionview registerNib:[UINib nibWithNibName:@"MyCommentCollectionViewCell" bundle:nil] forCellWithReuseIdentifier:@"MyCommentCollectionViewCell"];
    
    self.myCollectionview.showsHorizontalScrollIndicator = NO;
    self.myCollectionview.showsVerticalScrollIndicator = NO;
    
    //self.myCollectionview.alwaysBounceVertical = YES;
    //self.myCollectionview.alwaysBounceHorizontal = YES;
    
    
    //    self.collectionView.bounces = NO;
    self.myCollectionview.backgroundColor = [UIColor whiteColor];
    
    // [self.myCollectionview  addSubview:downcollectionView];
    
    [self.myCollectionview registerNib:[UINib nibWithNibName:@"MyComentWithImageViewCell" bundle:nil] forCellWithReuseIdentifier:@"MyComentWithImageViewCell"];
    
}
//数量
- (NSInteger)collectionView:(UICollectionView *)collectionView numberOfItemsInSection:(NSInteger)section{
    
    NSLog(@"~~~~~~~~~~~~~~~~~~~~~~~%lu", (unsigned long)self.arrOfPic.count);
    
    return self.arrOfPic.count;
    
    
    
}
                                   
                              
                                   
//内容
- (CGSize)collectionView:(UICollectionView *)collectionView layout:(UICollectionViewLayout*)collectionViewLayout sizeForItemAtIndexPath:(NSIndexPath *)indexPath
{
        return CGSizeMake((DEF_SCREEN_WIDTH - 80)  / 3, 105);
}
- (UICollectionViewCell *)collectionView:(UICollectionView *)collectionView cellForItemAtIndexPath:(NSIndexPath *)indexPath{
    
    MyCommentCollectionViewCell *cell = [collectionView dequeueReusableCellWithReuseIdentifier:@"MyCommentCollectionViewCell" forIndexPath:indexPath];
    
    for ( int i = 0; i< self.arrOfPic.count; i++) {
        
        NSString *urlN=manage(AP_HOST, self.arrOfPic[i]);
        
        
        [cell.img sd_setImageWithURL:[NSURL URLWithString:urlN] placeholderImage:[UIImage imageNamed:@""]];
        
    }
    
   
    
    
    
    
    return cell;
}


@end
